//
//  ViewController.m
//  tongxunlu
//
//  Created by mac on 15-11-16.
//  Copyright (c) 2015年 yb. All rights reserved.
//

#import "ViewController.h"
#import <QuartzCore/QuartzCore.h>
#import "iphoneViewController.h"
#import "testViewController.h"

@interface ViewController ()
{
    //定义
    UILabel *l;

}
@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    
    //导航栏的标题
    self.title = @"我的标题栏";
    
    //界面背景
    self.view.backgroundColor = [UIColor whiteColor];
    //文字位置，颜色
    l = [UILabel new];
    l.text = @"中国移动";
    [l sizeToFit];
    l.center = CGPointMake(150, 50);
    //l.center = CGPointMake(self.view.frame.size.width / 2.0, self.view.frame.size.height / 2.0);
    l.textColor = [UIColor blackColor];
    [self.view addSubview:l];

}

- (void)viewDidAppear:(BOOL)animated
{
    //设置按钮，颜色，位置
    [super viewDidAppear:animated];
    //[UIView animateWithDuration:1 animations:^{
        //l.center = CGPointMake(50, 350);
        //l.center = CGPointMake(self.view.frame.size.width / 2.0, self.view.frame.size.height / 2.0);
   // }];
    
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn.frame = CGRectMake(50, 335, 40, 40);
    //btn.frame = CGRectMake(50, 50, 100, 44);
    [btn setTitle:@"☎️" forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor blackColor] forState: UIControlStateNormal];
    [btn addTarget:self action:@selector(onClick:) forControlEvents:UIControlEventTouchUpInside];
    
    [self.view addSubview:btn];
    
    UIButton *btn2 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn2.frame = CGRectMake(200, 335, 40, 40);
    //btn.frame = CGRectMake(50, 50, 100, 44);
    [btn2 setTitle:@"🌲" forState:UIControlStateNormal];
    [btn2 setTitleColor:[UIColor blackColor] forState: UIControlStateNormal];
    [btn2 addTarget:self action:@selector(onClick2:) forControlEvents:UIControlEventTouchUpInside];
    
    [self.view addSubview:btn2];
}

- (void)onClick:(id)sender
{
    iphoneViewController *con = [iphoneViewController new];
    [self.navigationController pushViewController:con animated:YES];
}

- (void)onClick2:(UIButton *)sender
{
    testViewController *con1 = [testViewController new];
    [self.navigationController pushViewController:con1 animated:YES];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
